home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / LhALZXDirDOps5 / LZXDir-handler < prev    next >
Text File  |  1995-06-28  |  3KB  |  103 lines

  1. /*
  2.   $VER: LZXDir-handler 1.1 (26.6.95)
  3.  
  4.   modified by tINIC/mAXIMUM
  5.  
  6.   Custom handler for LZXDir.dopus5.
  7. */
  8.  
  9. options results
  10. options failat 11
  11.  
  12. parse arg portname
  13. parse var portname '.' portno
  14. address value portname
  15.  
  16. if ~show('l','rexxsupport.library') then
  17.    call addlib('rexxsupport.library',0,-30,0)
  18.  
  19. call openport('LZXDir-handler'portno)
  20.  
  21. dopus addtrap copy 'LZXDir-handler'portno
  22. dopus addtrap move 'LZXDir-handler'portno
  23. dopus addtrap delete 'LZXDir-handler'portno
  24. dopus addtrap parent 'LZXDir-handler'portno
  25. dopus addtrap makedir 'LZXDir-handler'portno
  26.  
  27. do forever
  28.    if waitpkt('LZXDir-handler'portno) then do
  29.       packet=getpkt('LZXDir-handler'portno)
  30.  
  31.       event=getarg(packet,0)
  32.       handle=getarg(packet,1)
  33.       name=getarg(packet,2)
  34.       user=getarg(packet,3)
  35.  
  36.       if upper(event)='MAKEDIR' then do
  37.             cmd='MAKEDIR'
  38.             address command 'Run >NIL: <NIL: rx DOpus5:arexx/LZXDir.dopus5' cmd portname handle '"'name'"'
  39.       end
  40.  
  41.       if upper(event)='COPY' then do
  42.             cmd='COPY'
  43.             address command 'Run >NIL: <NIL: rx DOpus5:arexx/LZXDir.dopus5' cmd portname handle '"'name'"'
  44.       end
  45.  
  46.       if upper(event)='MOVE' then do
  47.             cmd='MOVE'
  48.             address command 'Run >NIL: <NIL: rx DOpus5:arexx/LZXDir.dopus5' cmd portname handle '"'name'"'
  49.       end
  50.  
  51.       if upper(event)='DELETE' then do
  52.             cmd='DELETE'
  53.             address command 'Run >NIL: <NIL: rx DOpus5:arexx/LZXDir.dopus5' cmd portname handle '"'name'"'
  54.       end
  55.  
  56.       if upper(event)='PARENT' then do
  57.          lister query handle path
  58.          winpath=result
  59.          oldpath=getarg(packet,4)
  60.          test=upper(winpath)
  61.          newpos=lastpos('/',winpath,lastpos('/',winpath)-1)
  62.          newpos1=lastpos(':',winpath,lastpos('/',winpath)-1)
  63.          if newpos1>newpos then newpos=newpos1
  64.          newpath=left(winpath,newpos)
  65.          lister read handle '"'newpath'"' force
  66.          address command 'Run >NIL: <NIL: rx DOpus5:arexx/LZXDir.dopus5 GETDIR' portname ' ' handle '""'
  67.       end
  68.  
  69.       if upper(event)='DOUBLECLICK' then do
  70.          lister query handle entry '"'name'"' stem fileinfo.
  71.          if fileinfo.type>0 then do  /* it's a dir */
  72.             name=name'/'
  73.             cmd='GETDIR'
  74.             end
  75.          else
  76.             if pos(upper(right(name,4)),'.LZX')>0 then  /* archive in an archive */
  77.                cmd='GETDIR'
  78.             else
  79.                cmd='DOUBLECLICK'
  80.          address command 'Run >NIL: <NIL: rx DOpus5:arexx/LZXDir.dopus5' cmd portname handle '"'name'"'
  81.          end
  82.  
  83.       if upper(event)='INACTIVE' then do
  84.          lister query handle path
  85.          winpath=result
  86.          oldpath=getarg(packet,4)
  87.          test=upper(winpath)
  88.          if winpath=left(oldpath,length(winpath))&(pos('.LZX/',test)>0) then  /* user did parent */
  89.             address command 'Run >NIL: <NIL: rx DOpus5:arexx/LZXDir.dopus5 GETDIR' portname handle '""'
  90.          else
  91.             address command 'Delete >NIL: T:LZXDir.list'handle 'QUIET'  /* remove temp file */
  92.          end
  93.  
  94.       if upper(event)='DROP' then do
  95.          name=strip(name,'t')
  96.          if right(name,1)=':' then
  97.             lister read handle '"'name'"' force  /* user dropped a volume icon */
  98.          end
  99.  
  100.       call reply(packet,0)
  101.       end
  102.    end
  103.